@extends('Api.common.title')
@section('content')
    <div style="padding: 15px;">
        <fieldset class="layui-elem-field">
            <legend>权限管理 - 角色列表</legend>
            <div class="layui-field-box">
                <form class="layui-form" action="">
                    <div class="layui-form-item" style="text-align:center;">
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" placeholder="请输入名称" type="text" name="title"
                                       value="{{$select['title']}}">
                            </div>
                        </div>
                        <div class="layui-inline" style="text-align:left;">
                            <div class="layui-input-inline">
                                <button class="layui-btn"><i class="layui-icon">&#xe615;</i>查询</button>
                            </div>
                        </div>
                    </div>
                </form>
                <hr>
                <div class="layui-btn-group">
                    <button class="layui-btn layui-btn-xs layui-btn-normal dw-dailog" dw-url="create"
                            dw-title="新增角色"
                            dw-width="600px" dw-height="400px">
                        <i class="layui-icon">&#xe654;</i>新增
                    </button>
                    {{-- <button class="layui-btn layui-btn-xs layui-btn-danger dw-batch-delete" dw-url="delete">
                         <i class="layui-icon">&#xe640;</i>删除
                     </button>--}}
                    <button class="layui-btn layui-btn-xs dw-refresh">
                        <i class="layui-icon">&#x1002;</i>刷新
                    </button>
                </div>
                <hr>
                <table class="layui-table  layui-form">
                    <colgroup>
                        <col>
                        <col width="20%">
                        <col>
                        <col>
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th class="selectAll"></th>
                        <th>名称</th>
                        <th>状态</th>
                        <th>权限分配</th>
                        <th>备注</th>
                        <th style="text-align:center;">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($list as $vo)
                        <tr>
                            <td>{{$vo['id']}}</td>
                            <td>
                                <span style="cursor: pointer;" class="layui-badge to-view" id="view_{{$vo['id']}}" dw-url="{:url('Role/admin')}?id={{$vo['id']}}">{{$vo['title']}}</span>
                            </td>
                            <td>{{$vo['status_name']}}</td>
                            <td>
                                <button class="layui-btn layui-btn-xs layui-btn-danger dw-dailog"
                                        dw-url="permission?id={{$vo['id']}}" dw-title="分配权限"
                                        dw-width="70%" dw-height="80%">
                                    <i class="layui-icon">&#xe672;</i>分配权限
                                </button>
                            </td>
                            <td>{{$vo['remark']}}</td>
                            <td class="text-center">
                                <div class="layui-btn-group">
                                    @if(in_array($vo['id'],\App\Utils\ConstantUtil::userPower()))
                                        <button class="layui-btn layui-btn-xs layui-btn-danger layui-btn-disabled">
                                            <i class="layui-icon">&#xe642;</i>编辑
                                        </button>
                                        {{--    <button class="layui-btn layui-btn-xs layui-btn-danger layui-btn-disabled">
                                                <i class="layui-icon">&#xe640;</i>删除
                                            </button>--}}
                                    @else
                                        <button class="layui-btn layui-btn-xs layui-btn-normal dw-dailog"
                                                dw-width="600px" dw-height="400px"
                                                dw-url="edit?id={{$vo['id']}}"
                                                dw-title="编辑角色">
                                            <i class="layui-icon">&#xe642;</i>编辑
                                        </button>
                                        {{--     <button class="layui-btn layui-btn-xs layui-btn-danger dw-delete"
                                                     dw-url="delete?id={{$vo['id']}}"
                                                     dw-title="{{$vo['title']}}">
                                                 <i class="layui-icon">&#xe640;</i>删除
                                             </button>--}}
                                    @endif
                                </div>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                <div class="dw-page">    {!! $list->render() !!}
                </div>
            </div>
        </fieldset>
    </div>
@endsection